libxl: events: Tear down SIGCHLD machinery on ctx destruction
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 27 Nov 2014 18:04:29 +0000 (18:04 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 10 Dec 2014 13:48:31 +0000 (13:48 +0000)
commit5a9682574538e7cc1b59c17af19ced628ccfe594
treea4eb34f949dcbe8d45dbaeaa14da39b493519903
parent4b9143e4a447789fab45162edd9cbf00512b88a9
libxl: events: Tear down SIGCHLD machinery on ctx destruction

We want to have no fd events registered when we are idle.
Also, we should put back the default SIGCHLD handler.  So:

 * In libxl_ctx_free, use libxl_childproc_setmode to set the mode to
   the default, which is libxl_sigchld_owner_libxl (ie `libxl owns
   SIGCHLD only when it has active children').

   But of course there are no active children at libxl teardown so
   this results in libxl__sigchld_notneeded: the ctx loses its
   interest in SIGCHLD (unsetting the SIGCHLD handler if we were the
   last ctx) and deregisters the per-ctx selfpipe fd.

 * assert that this is the case: ie that we are no longer interested
   in the selfpipe.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
tools/libxl/libxl.c